<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>语音test</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/element-ui@2.15.13/lib/theme-chalk/index.min.css" />
    <script src="https://cdn.jsdelivr.net/npm/jquery@2.2.4/dist/jquery.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/vue@2.7.14/dist/vue.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/element-ui@2.15.13/lib/index.min.js"></script>
</head>
<body>
<div id="app">
    <template>
        <el-button :plain="true" v-model="text" @click="voiceBroadcast(text)">打开消息提示</el-button>
        <!-- 告警音 -->
        <audio id="audio" src="/dingdanVoice.mp3"/>

    </template>

</div>
<script>
    var app = new Vue({
        el: "#app",
        data: {
            text:"您有一个新的订单请尽快处理"
        },
        methods: {
            voiceBroadcast(text) {
                console.log(text)
                this.$message(text);
                const audio = document.getElementById('audio')
                audio.play()

            }


        }
    });
</script>
</body>
</html>